<?php
/**
 * @version        $Id$
 * @author         master@xuewl.com
 * @copyright      Copyright (c) 2007 - 2014, Chongqing xuewl Information Technology Co., Ltd.
 * @link           http://www.xuewl.com
**/
class announce { 
    function __construct() {
        $this->categorys = getcache('category','commons');
        $this->models = getcache('model','commons');
        $this->db = D('Announce');
    }
    /**
     * 查询数据列表
     * @author xuewl <master@xuewl.com>
     */
    public function lists($data) {
      $sql_map = time() .' > starttime AND endtime > '. time().' OR '.time().' > starttime AND endtime = 0 AND status = 1';

      $result = $this->db->where($sql_map)->limit(0,10)->select();
       return $result;
    }
    /**
     * 查询公告据列表
     * @author xuewl <master@xuewl.com>
     */
    public function show($data){
      $rs = $this->db->where(array('status'=>1))->select();
      $tmp = array();
      foreach ($rs as $key => $v) {
        $v['url'] = U('Announce/Index/show',array('catid'=>19,'id'=>$v['aid']));
        $tmp[$key] = $v;
      }
      return $tmp;
    }

}